
const webpack = require('webpack');           //引入配置文件
const path = require('path');

var config = {

    entry: {
        index: './index.js'             //入口文件
    },
    output: {                                                    //打包自后出口文件
        path: __dirname + '/dist',
        filename: 'bundle.js',     //输入文件
        publicPath: ""            //要用静态内容在前面加上这个路由
    },
    devtool: 'none',
    devServer: {
        contentBase: __dirname,//本地服务器所加载的页面所在的目录
        historyApiFallback: true,//路由不跳转
        inline: true,//实时刷新
        hot: true,
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                loader: 'babel-loader',
            },
        ]
    },
    resolve: {
        extensions: [".js", ".jsx", ".css", '.vue']//默认值       //默认扩展名
    },
    plugins: [                                         //插件机制
        new webpack.HotModuleReplacementPlugin()     //hot module replacement 启动模块热替换的插件
    ],
}
module.exports = config;